var t = require("../../@babel/runtime/helpers/defineProperty"), a = getApp();

Page({
    data: {
        getListData: [],
        isLoadMore: !0,
        page: 1,
        total_page: 0,
        selected: 0,
        name: ""
    },
    onLoad: function(t) {
        this.getList();
    },
    getList: function() {
        var e = this, o = a.getNetAddresss("plugin.coupon-qr.api.index.getList");
        a._postNetWork({
            url: o,
            showToastIn: !1,
            data: {
                name: this.data.name
            },
            success: function(a) {
                var o, n = a.data;
                1 == n.result ? e.setData((t(o = {}, "getListData[0]", n.data.data), t(o, "total_page", n.data.last_page), 
                o)) : wx.showToast({
                    icon: "none",
                    title: n.msg,
                    duration: 1500
                });
            },
            fail: function(t) {}
        });
    },
    searchbtn: function(t) {
        var a = t.detail.value;
        this.setData({
            name: a
        });
    },
    searchConfirm: function(t) {
        this.getList();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    _getMoreData: function() {
        var e = this, o = a.getNetAddresss("plugin.coupon-qr.api.index.getList");
        this.data.page >= this.data.total_page ? e.setData({
            isLoadMore: !1,
            name: this.data.name
        }) : (e.setData({
            page: e.data.page + 1
        }), a._postNetWork({
            url: o,
            showToastIn: !1,
            data: {
                page: this.data.page
            },
            success: function(a) {
                var o = a.data;
                1 == o.result ? e.setData(t({
                    isLoadMore: !0
                }, "getListData[" + e.data.getListData.length + "]", o.data.data)) : e.setData({
                    page: e.data.page - 1,
                    isLoadMore: !1
                });
            },
            fail: function(t) {}
        }));
    },
    onShareAppMessage: function() {},
    couponcodebtn: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageC/couponcode/couponcode?id=" + a
        });
    }
});